<?php

namespace Config;

/**
 * 日志配置
 *
 * @version 1.0
 * @author 张云江
 */
class LogConfig
{
    const key = "__LOGKEY__";
    /**
     * 配置日志功能
     * @param mixed $is_log 是否启用日志
     * @param mixed $log_level 日志等级
     * @param mixed $log_path 日志路径
     */
    public static function setConfig($is_log, $log_level, $log_path)
    {
        $is_log = (bool)$is_log;
        $log_level = (string)$log_level;
        $log_path = (string)$log_path;
        $GLOBALS[self::key] = array(
            "is_log" => $is_log,
            "log_level" => $log_level,
            "log_path" => $log_path
        );
    }
    /**
     * 是否启用日志
     * @return bool
     */
    public static function getConfigWithIs_Log()
    {
        if (array_key_exists(self::key, $GLOBALS))
            return (bool)$GLOBALS[self::key]["is_log"];
        return false;
    }
    /**
     * 获取日志等级
     * @return string
     */
    public static function getConfigWithLog_Level()
    {
        if (array_key_exists(self::key, $GLOBALS))
            return (string)$GLOBALS[self::key]["log_level"];
        return "";
    }
    /**
     * 获取日志根路径
     * @return string
     */
    public static function getConfigWithLog_Path()
    {
        if (array_key_exists(self::key, $GLOBALS))
            return (string)$GLOBALS[self::key]["log_path"];
        return "";
    }
}
